<template>
    <div class="book-display">
      <div class="book" v-for="(book, index) in books" :key="index">
        <img :src="book.image" alt="书籍封面" class="book-image" />
        <div class="book-info">
          <h3 class="book-title">{{ book.title }}</h3>
          <p class="book-author">{{ book.author }}</p>
        </div>
      </div>
    </div>
  </template>
  
  <script>
  export default {
    name: 'BookList',
    props: {
      books: {
        type: Array,
        required: true
      }
    }
  }
  </script>
  
  <style scoped>
  .book-display {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
  }
  
  .book {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
  }
  
  .book-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
  }
  
  .book-title {
    font-size: 1.1em;
    margin: 8px 0;
  }
  
  .book-author {
    color: #555;
  }
  </style>
  